package plagiarism;

import java.util.ArrayList;

import seperator.AWLSeperator;
import seperator.NounSeperator;
import seperator.NumberSeperator;
import seperator.PrepSeperator;
import seperator.PuntSeperator;
import seperator.QuotationSeperator;

import words.AWL;
import words.Article;
import words.Noun;
import words.NumberStat;
import words.Preposition;
import words.Punctuation;
import words.Quotation;


public class Seperator 
{
	private Article article;
	private String[] datalist;
	private int article_count;
	public Seperator()
	{
		this.article = null;
		this.datalist = null;
		this.article_count = 0;
	}
	public Seperator(int art_count)
	{
		this.article = null;
		this.datalist = null;
		this.article_count = art_count;
	}
	public boolean set_data(String[] datalist)
	{
		if(datalist != null)
		{
			this.datalist = datalist;
			return true;		
			}
		else
		{
			return false;
		}
		
	}
	public boolean seperate()
	{
		try
		{
			this.article = new Article();

			QuotationSeperator quotationseperator = new QuotationSeperator();
			quotationseperator.setdata(datalist);
			quotationseperator.seperate();
			AWLSeperator awlseperator = new AWLSeperator();
			awlseperator.setdata(datalist);
			awlseperator.seperate();
			AWL awl = awlseperator.getAWL();
			NounSeperator nounseperator = new NounSeperator();
			nounseperator.setdata(datalist);
			nounseperator.seperate();
			Noun noun = nounseperator.getResult();
			PuntSeperator puntseperator = new PuntSeperator();
			puntseperator.setdata(datalist);
			puntseperator.seperate();
			Punctuation punt = puntseperator.getPunt();
			NumberSeperator numbseperator = new NumberSeperator();
			numbseperator.setdata(datalist);
			numbseperator.seperate();
			NumberStat numb = numbseperator.getResult();
			PrepSeperator prepseperator = new PrepSeperator();
			prepseperator.setdata(datalist);
			prepseperator.seperate();
			Preposition prep = prepseperator.getPrep();
			
			
			
			Quotation quotation = quotationseperator.getResult();
			article.addQuotation(quotation);
			article.addAWL(awl);
			article.addNoun(noun);
			article.addPunt(punt);
			article.addNumber(numb);
			article.addPrep(prep);
			return true;
		}
		catch(Exception e)
		{
			e.printStackTrace();
			return false;
		}
	}
	public Article getArticle()
	{
		return this.article;
	}
}

